<template>
  <div id="app">
    <v-header :seller="seller"></v-header>
    <div class="tab">
      <div class="tab_item">
        <router-link to="/goods">商品</router-link>
      </div>
      <div class="tab_item">
        <router-link to="/ratings">评论</router-link>
      </div>
      <div class="tab_item">
        <router-link to="/seller">商家</router-link>
      </div>
    </div>
    <div class="content">
      <keep-alive>
        <router-view :seller="seller"></router-view>
      </keep-alive>
    </div>
  </div>
</template>

<script>
import header from "./components/header/header.vue";
const ERR_OK = 0;
export default {
  data() {
    return {
      seller: {}
    };
  },
  created() {
    this.$ajax({
      method: "get",
      url: "/api/seller"
    })
      .then(res => {
        if (res.data.errno == ERR_OK) {
          this.seller = res.data.data;
        }
      })
      .catch(err => {
        console.log(err);
      });
  },
  components: {
    "v-header": header
  }
};
</script>

<style scoped>
.tab {
  display: flex;
  width: 100%;
  height: 40px;
  line-height: 40px;
  border-bottom: 1px solid #dbdbdb;
  border-top: 1px solid #dbdbdb;
}

.tab .tab_item {
  flex: 1;
  text-align: center;
}

.router-link-active {
  color: #ff0000;
}
</style>
